#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

/*
[5, 1, 4, 2]

不许用除法
[8, 40, 10, 20]
*/
/*
time complexity: O(n^2) n - array 的大小
space compexity: O(n) n - array 的大小
*/
vector<int> arrayOfProduct(const vector<int> &array) {
  vector<int> result;

  for (int i = 0; i < array.size(); ++i) {
    int p = 1;

    for (int j = 0; j < array.size(); ++j) {
      if (i != j) {
        p = p * array[j];
      }
    }

    result.push_back(p);
  }

  return result;
}

/*
[5, 1, 4, 2]
 ^
product = 40
[1, 5, 5, 20] leftProducts
[x, x, x, x] rightProducts
[]
T: O(n) n -> array.size()
S: O(n) n -> array.size()
*/
vector<int> aop(const vector<int> &array) {
  // Write your code here.
	vector<int> result(array.size(), 1);
	
	int leftProduct = 1;
	for (int i = 0; i < array.size(); ++i) {
		/// `result[0]` is assumed to 1, because it will be
		/// calculated in the right side loop.
		result[i] = leftProduct;
		leftProduct *= array[i];
	}
	
	int rightProduct = 1;
	for (int i = array.size() - 1; i >= 0; --i) {
		/// We don't need to calculate `result[array.size()-1]`,
		/// because it already finished in the left loop. So we assume
		/// the initial value of `rightProduct` to 1.
		result[i] *= rightProduct;
		rightProduct *= array[i];
	}
	
	return result;
}

/*
./ArrayOfProduct < ArrayOfProduct.in
< 输入重定向
*/
int main(int argc, char const *argv[])
{
  /* code */
  int n = 0;
  cin >> n;

  vector<int> array;

  while (n > 0) {
    int i = 0;
    cin >> i;
    array.push_back(i);
    --n;
  }

  vector<int> result = aop(array);
  for (int n : result) {
    cout << n << " ";
  }
  cout << endl;


  return 0;
}
